package com.xinruke.hostels.dailymanage.controller;

import com.xinruke.hostels.common.controller.BaseController;
import com.xinruke.hostels.common.vo.ResultVO;
import com.xinruke.hostels.dailymanage.interfaces.dto.RemainCountQueryDto;
import com.xinruke.hostels.dailymanage.interfaces.dto.RoomReservationQueryDTO;
import com.xinruke.hostels.dailymanage.interfaces.dto.RoomReservationResultDTO;
import com.xinruke.hostels.dailymanage.interfaces.dto.roomstatus.*;
import com.xinruke.hostels.dailymanage.service.RoomStatusService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;


/**
 * 房态相关
 *
 * @author yutaipu
 */
@RestController
@RequestMapping("/room-status")
@Api(tags = "房态相关")
@Slf4j
public class RoomStatusController extends BaseController {

    @Autowired
    private RoomStatusService roomStatusService;

    @PostMapping("room/remain/count")
    @ApiOperation("剩余房数")
    public ResultVO<Integer>  queryRemainRoomCount(@RequestBody @Valid RemainCountQueryDto params) {
        return roomStatusService.queryRemainRoomCount(params);
    }

    @PostMapping("room/reservation")
    @ApiOperation("预订房间")
    public ResultVO<RoomReservationResultDTO>  roomReservation(@RequestBody @Valid RoomReservationQueryDTO params) {
        return roomStatusService.roomReservation(params);
    }

    /**
     * 1.房态数量统计
     */
    @PostMapping("/getRoomStatusCount")
    @ApiOperation("房态数量统计")
    public ResultVO<List<RSGetRoomCountQueryResultDTO>> getRoomStatusCount(@RequestBody @Valid RSGetRoomCountQueryDTO params) {
        return roomStatusService.getRoomStatusCount(params);
    }

    /**
     * 2.房间列表 3.入住统计
     */
    @PostMapping("/listRoom")
    @ApiOperation("房间列表、入住统计")
    public ResultVO<RSListRoomQueryResultDTO> listRoom(@RequestBody @Valid RSListRoomQueryDTO params) {
        return roomStatusService.listRoom(params);
    }

    /**
     * 4.入住信息
     */
    @PostMapping("/getCheckInDetail")
    @ApiOperation("入住信息")
    public ResultVO<RSCheckInDetailQueryResultDTO> getCheckInDetail(@RequestBody @Valid RSCheckInDetailQueryDTO params) {
        return roomStatusService.getCheckInDetail(params);
    }

//    /**
//     * 5.空房信息
//     */
//    public ResultVO<RSRoomDetailDTO> getRoomDetail(RSCheckInDetailQueryDTO params) {
//        return ResultVO.success();
//    }

    @PostMapping("/setClean")
    @ApiOperation("置净")
    public ResultVO setClean(@RequestBody @Valid RSSetCleanDTO params){
        return roomStatusService.setClean(params);
    }

    @PostMapping("/setDirty")
    @ApiOperation("置脏")
    public ResultVO setDirty(@RequestBody @Valid RSSetDirtyDTO params){
        return roomStatusService.setDirty(params);
    }

    @PostMapping("/setRepair")
    @ApiOperation("置维修")
    public ResultVO setRepair(@RequestBody @Valid RSRepairDTO params){
        return roomStatusService.setRepair(params);
    }

    @PostMapping("/setLocked")
    @ApiOperation("锁房")
    public ResultVO setLocked(@RequestBody @Valid RSLockedDTO params){
        return roomStatusService.setLocked(params);
    }

    @PostMapping("/setCleanBatch")
    @ApiOperation("批量置净")
    public ResultVO setCleanBatch(@RequestBody @Valid RSSetCleanBatchDTO params) {
        return roomStatusService.setCleanBatch(params);
    }

    @PostMapping("/setDirtyBatch")
    @ApiOperation("批量置脏")
    public ResultVO setDirtyBatch(@RequestBody @Valid RSSetDirtyBatchDTO params) {
        return roomStatusService.setDirtyBatch(params);
    }

//    //7.房态颜色
//    public ResultVO<RSCheckInDetailQueryResultDTO> listRommStatusColor(RSCheckInDetailQueryDTO params) {
//        return ResultVO.success();
//    }

//    //8.根据楼栋获取楼层列表
//    public ResultVO<RSCheckInDetailQueryResultDTO> listFloorByBuildingId(RSCheckInDetailQueryDTO params) {
//        return ResultVO.success();
//    }
//
//    //9.房型查询列表
//    public ResultVO<RSCheckInDetailQueryResultDTO> check8In(RSCheckInDetailQueryDTO params) {
//        return ResultVO.success();
//    }
}
